package com.pingao.mp.modular.fls.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 中奖结果
 * </p>
 *
 * @author 闻品高
 * @since 2020-01-15
 */
@TableName("fls_activity_win_result")
@Data
public class ActivityWinResult extends Model<ActivityWinResult> {

    private static final long serialVersionUID = 1L;
    //JsonSerialize解决数据传递到前端的时候其精度会丢失的问题，在序列化的时候把其序列化成字符串类型
    @JsonSerialize(using = ToStringSerializer.class)
    //ID_WORKER，采用mybatis-plus提供的雪花算法自动生成主键值
    @TableId(value = "id", type = IdType.ID_WORKER)
    private Long id;

    /**
     * 活动ID
     */
    private Long activityId;

    /**
     * 活动奖项ID
     */
    private Long activityAwardsId;

    /**
     * 中奖人ID
     */
    private Long userId;

    /**
     * 中奖人手机号码
     */
    private String userMobile;

    /**
     * 中奖人称呼
     */
    private String userName;

    /**
     * 中奖人性别（1：男、2：女、3：未知）
     */
    private Integer userGender;

    /**
     * 中奖时间
     */
    private LocalDateTime winTime;

    /**
     * 备注
     */
    private String remark;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    public static final String COL_ID = "id";
    public static final String COL_ACTIVITY_ID = "activity_id";
    public static final String COL_ACTIVITY_AWARDS_ID = "activity_awards_id";
    public static final String COL_USER_ID = "user_id";
    public static final String COL_USER_MOBILE = "user_mobile";
    public static final String COL_USER_NAME = "user_name";
    public static final String COL_USER_GENDER = "user_gender";
    public static final String COL_WIN_TIME = "win_time";
}
